﻿using Authentication.Data.Repository;
using Authentication.Model.Interface;

namespace Authentication.Provider
{
    public class ProviderFactory : IProviderFactory
    {
        private AuthenticationRepository data = null;
        public AuthenticationRepository Data
        {
            get
            {
                if (data == null) data = new AuthenticationRepository();
                return data;
            }
        }

        private IApplicationProvider applications = null;
        public IApplicationProvider Applications
        {
            get
            {
                if (applications == null) applications = new ApplicationProvider();
                return applications;
            }
        }

        private IUserProvider users = null;
        public IUserProvider Users
        {
            get
            {
                if (users == null) users = new AccountProvider();
                return users;
            }
        }


        private IObjectProvider objects = null;
        public IObjectProvider Objects
        {
            get
            {
                if (objects == null) objects = new ObjectProvider();
                return objects;
            }
        }

        private IConfigurationProvider configurations = null;
        public IConfigurationProvider Configurations
        {
            get
            {
                if (configurations == null) configurations = new ConfigurationProvider();
                return configurations;
            }
        }


        private IRoleProvider roles = null;
        public IRoleProvider Roles
        {
            get
            {
                if (roles == null) roles = new RoleProvider();
                return roles;
            }
        }

        private IGroupProvider groups = null;
        public IGroupProvider Groups
        {
            get
            {
                if (groups == null) groups = new GroupProvider();
                return groups;
            }
        }

        private IGroupRoleProvider groupRole = null;
        public IGroupRoleProvider GroupRole
        {
            get
            {
                if (groupRole == null) groupRole = new GroupRoleProvider();
                return groupRole;
            }
        }

        public IUserRoleProvider userRole = null;
        public IUserRoleProvider UserRole
        {
            get
            {
                if (userRole == null) userRole = new AccountRoleProvider();
                return userRole;
            }
        }
    }
}
